<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>

<body>
    <div>
        <span>
            <p>我是p标签</p>
        </span>
        <span>我是span标签</span>
    </div>
    <script src="./jquery-3.6.0.js"></script>
    <script>
        //1.父子关系 找后代  JQ.find(css选择器)
        //let a = $('div').find('p')
        //console.log(a);

        //2.JQ.children()  方法  无参数， 是所有子代    有css选择器参数  指定子代
        //let b = $('div').children('span')
        //console.log(b);

        //3.JQ.parent()   找父级
        //let c = $('p').parent('div')
        //console.log(c);这个是不成立的  p 的父级是span
        //let c = $('p').parent('span')
        //console.log(c);

        //4.JQ.parents()   找父辈们JQ对象
        let d = $('p').parents('div')
        console.log(d);
    </script>
</body>

</html>